package com.epro.dx.widget;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.epro.dx.R;

/**
 * 等待动画控件
 */
public class WaitingAnimAreaWidget
{
    
    private Context mContext;
    
    private View mWaitingAnimArea;
    
    private View mRotateHeart;
    
    /**
     * 等待动画控件
     * @param context 
     * @param waitingAnimArea 
     */
    public WaitingAnimAreaWidget(Context context, View waitingAnimArea)
    {
        mWaitingAnimArea = waitingAnimArea;
        mContext = context;
        init();
    }
    
    private void init()
    {
        mRotateHeart = mWaitingAnimArea.findViewById(R.id.bg);
    }
    
    /**
     * 开始动画
     */
    public void startAnimation()
    {
        Animation clockwiseRotate = AnimationUtils.loadAnimation(mContext, R.anim.loading_animation);
        mRotateHeart.startAnimation(clockwiseRotate);
        
    }
    
    /**
     * 停止动画
     */
    public void stopAnimation()
    {
        mRotateHeart.clearAnimation();
        
    }
}
